interface Component {
    String operation();
}

class ConcreteComponent implements Component {
    public String operation() {
        return "原始操作";
    }
}

abstract class Decorator implements Component {
    protected Component component;

    public Decorator(Component component) {
        this.component = component;
    }

    public String operation() {
        return component.operation();
    }
}

class ConcreteDecoratorA extends Decorator {
    public ConcreteDecoratorA(Component component) {
        super(component);
    }

    public String operation() {
        return "装饰A: " + super.operation();
    }
}

class ConcreteDecoratorB extends Decorator {
    public ConcreteDecoratorB(Component component) {
        super(component);
    }

    public String operation() {
        return "装饰B: " + super.operation();
    }
}

class DecoratorPattern {
    public Component decorate(Component component) {
        return new ConcreteDecoratorB(new ConcreteDecoratorA(component));
    }
}